package extras;
/**
 * Clase que provee distintas funcionalidades 
 * a la aplicacion  
 * @author ALS Telecom
 */
public class Utils 
{
	/**
	 * 
	 */
    Utils()
    {
    }
    
    /**
     * Divide una cadena de caracteres donde exista el delimitadory
     * y es opcional que este el delimitador 
     * @param inputstring Dato de Entrada
     * @param delimiter caracteres donde se dividira el dato de entrada
     * @return
     */
    /**
    public static EncodedImage resizeImage(EncodedImage image, int width, int height) {
	    if (image == null) {
	      return image;
	    }

	    //return if image does not need a resizing
	    if (image.getWidth() <= width && image.getHeight() <= height) {
	      return image;
	    }
	   
	    double scaleHeight, scaleWidth;
	    if (image.getWidth() > width && image.getHeight() > height) {  //actual image is bigger than scale size
	      if (image.getWidth() > image.getHeight()) {  //actual image width is more that height then scale with width
	        scaleWidth = width;
	        scaleHeight = (double)width / image.getWidth() * image.getHeight();
	      } else { //scale with height
	        scaleHeight = height;
	        scaleWidth = (double)height / image.getHeight() * image.getWidth();
	      }
	    } else if (width < image.getWidth()) { //scale with scale width or height
	      scaleWidth = width;
	      scaleHeight = (double)width / image.getWidth() * image.getHeight();
	    } else {
	      scaleHeight = height;
	      scaleWidth = (double)height / image.getHeight() * image.getWidth();
	    }
	    int w = Fixed32.div(Fixed32.toFP(image.getWidth()), Fixed32.toFP((int)scaleWidth));
	    int h = Fixed32.div(Fixed32.toFP(image.getHeight()), Fixed32.toFP((int)scaleHeight));
	    return image.scaleImage32(w, h);
	  }
    **/
    /**
	 * 
	 * @param vector
	 * @return
	 */
    /**
	public static Lista[] RetrieveListaFromSoap(Vector vector){
			Lista[] listas = new Lista[vector.size()-1];
			for(int i=1;i<vector.size();i++){
				SoapObject soap = (SoapObject) vector.elementAt(i);
				Lista lista = new Lista(soap);				
				listas[i-1] = lista;
			}			
		return listas;
	}
	**/
	
	/**
	public static Lugar[] RetrieveLugaresFromSoap(Vector vector) {
		
		Lugar[] lugares = new Lugar[vector.size()-1];
		for(int i=1;i<vector.size();i++){
			SoapObject soap = (SoapObject) vector.elementAt(i);
			Lugar lugar = new Lugar(soap);				
			lugares[i-1] = lugar;
		}			
		return lugares;
		
	}
	**/
	public static String parseDate(String fecha) {
		// TODO Auto-generated method stub
		int pos1 = fecha.indexOf('/');
		String dia = fecha.substring(0,pos1);
		int pos2 = pos1+1;
		String cad = fecha.substring(pos2);
		int pos3 = cad.indexOf('/');
		String mes = cad.substring(0,pos3);
		int pos4 = pos1+1;
		String ano = cad.substring(pos4);
		return ano+"-"+mes+"-"+dia;
	}
	
}
	
